{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['草莓', 29],\n",
       " ['芒果', 51],\n",
       " ['葡萄', 26],\n",
       " ['雪梨', 37],\n",
       " ['西瓜', 116],\n",
       " ['柠檬', 56],\n",
       " ['车厘子', 90]]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.globals import CurrentConfig, NotebookType\n",
    "CurrentConfig.NOTEBOOK_TYPE = NotebookType.JUPYTER_LAB\n",
    "\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Pie\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "\n",
    "\n",
    "data = [list(z) for z in zip(Faker.choose(), Faker.values())]\n",
    "\n",
    "c = (\n",
    "    Pie()\n",
    "    .add(\"\", data)\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"Pie-基本示例\"))\n",
    "    .set_series_opts(label_opts=opts.LabelOpts(formatter=\"{b}: {c}\"))\n",
    ")\n",
    "c.load_javascript()\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"d8104856bf104341ae2be6d55a0976bb\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_d8104856bf104341ae2be6d55a0976bb = echarts.init(\n",
       "            document.getElementById('d8104856bf104341ae2be6d55a0976bb'), 'white', {renderer: 'canvas'});\n",
       "        var option_d8104856bf104341ae2be6d55a0976bb = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"colorBy\": \"data\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"selectedMode\": false,\n",
       "            \"selectedOffset\": 10,\n",
       "            \"clockwise\": true,\n",
       "            \"startAngle\": 90,\n",
       "            \"minAngle\": 0,\n",
       "            \"minShowLabelAngle\": 0,\n",
       "            \"avoidLabelOverlap\": true,\n",
       "            \"stillShowZeroSum\": true,\n",
       "            \"percentPrecision\": 2,\n",
       "            \"showEmptyCircle\": true,\n",
       "            \"emptyCircleStyle\": {\n",
       "                \"color\": \"lightgray\",\n",
       "                \"borderColor\": \"#000\",\n",
       "                \"borderWidth\": 0,\n",
       "                \"borderType\": \"solid\",\n",
       "                \"borderDashOffset\": 0,\n",
       "                \"borderCap\": \"butt\",\n",
       "                \"borderJoin\": \"bevel\",\n",
       "                \"borderMiterLimit\": 10,\n",
       "                \"opacity\": 1\n",
       "            },\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u8349\\u8393\",\n",
       "                    \"value\": 29\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8292\\u679c\",\n",
       "                    \"value\": 51\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8461\\u8404\",\n",
       "                    \"value\": 26\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u96ea\\u68a8\",\n",
       "                    \"value\": 37\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u897f\\u74dc\",\n",
       "                    \"value\": 116\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u67e0\\u6aac\",\n",
       "                    \"value\": 56\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8f66\\u5398\\u5b50\",\n",
       "                    \"value\": 90\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": [\n",
       "                \"0%\",\n",
       "                \"75%\"\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"50%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8,\n",
       "                \"formatter\": \"{b}: {c}\"\n",
       "            },\n",
       "            \"labelLine\": {\n",
       "                \"show\": true,\n",
       "                \"showAbove\": false,\n",
       "                \"length\": 15,\n",
       "                \"length2\": 15,\n",
       "                \"smooth\": false,\n",
       "                \"minTurnAngle\": 90,\n",
       "                \"maxSurfaceAngle\": 90\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u8349\\u8393\",\n",
       "                \"\\u8292\\u679c\",\n",
       "                \"\\u8461\\u8404\",\n",
       "                \"\\u96ea\\u68a8\",\n",
       "                \"\\u897f\\u74dc\",\n",
       "                \"\\u67e0\\u6aac\",\n",
       "                \"\\u8f66\\u5398\\u5b50\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"Pie-\\u57fa\\u672c\\u793a\\u4f8b\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_d8104856bf104341ae2be6d55a0976bb.setOption(option_d8104856bf104341ae2be6d55a0976bb);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7f309a2d90f0>"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": "new Promise(function(resolve, reject) {\n    var script = document.createElement(\"script\");\n    script.onload = resolve;\n    script.onerror = reject;\n    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n    document.head.appendChild(script);\n}).then(() => {\n\n});",
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x7f309a2d8e80>"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Bar\n",
    "\n",
    "\n",
    "bar = Bar().add_xaxis([\"total\"])\n",
    "for item in data:\n",
    "    bar.add_yaxis(item[0], [item[1]], stack=\"stack1\")\n",
    "bar.set_series_opts(label_opts=opts.LabelOpts(is_show=False)).set_global_opts(title_opts=opts.TitleOpts(title=\"Bar-堆叠数据（全部）\"))\n",
    "\n",
    "bar.load_javascript()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"4ebf0a9b140c4be4a64d81f8b226217c\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_4ebf0a9b140c4be4a64d81f8b226217c = echarts.init(\n",
       "            document.getElementById('4ebf0a9b140c4be4a64d81f8b226217c'), 'white', {renderer: 'canvas'});\n",
       "        var option_4ebf0a9b140c4be4a64d81f8b226217c = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u8349\\u8393\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                29\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stack\": \"stack1\",\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u8292\\u679c\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                51\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stack\": \"stack1\",\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u8461\\u8404\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                26\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stack\": \"stack1\",\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u96ea\\u68a8\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                37\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stack\": \"stack1\",\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u897f\\u74dc\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                116\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stack\": \"stack1\",\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u67e0\\u6aac\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                56\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stack\": \"stack1\",\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\\u8f66\\u5398\\u5b50\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                90\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stack\": \"stack1\",\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u8349\\u8393\",\n",
       "                \"\\u8292\\u679c\",\n",
       "                \"\\u8461\\u8404\",\n",
       "                \"\\u96ea\\u68a8\",\n",
       "                \"\\u897f\\u74dc\",\n",
       "                \"\\u67e0\\u6aac\",\n",
       "                \"\\u8f66\\u5398\\u5b50\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"total\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"Bar-\\u5806\\u53e0\\u6570\\u636e\\uff08\\u5168\\u90e8\\uff09\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_4ebf0a9b140c4be4a64d81f8b226217c.setOption(option_4ebf0a9b140c4be4a64d81f8b226217c);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7f309a2db0d0>"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": "new Promise(function(resolve, reject) {\n    var script = document.createElement(\"script\");\n    script.onload = resolve;\n    script.onerror = reject;\n    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n    document.head.appendChild(script);\n}).then(() => {\n\n});",
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x7f309a2d81f0>"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar2 = (\n",
    "    Bar()\n",
    "    .add_xaxis([item[0] for item in data])\n",
    "    .add_yaxis(\"data1\", [item[1] for item in data])\n",
    "    .set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"Bar-堆叠数据（全部）\"))\n",
    ")\n",
    "bar2.load_javascript()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"f1528710866a4d2d8a44122e86d96ca1\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_f1528710866a4d2d8a44122e86d96ca1 = echarts.init(\n",
       "            document.getElementById('f1528710866a4d2d8a44122e86d96ca1'), 'white', {renderer: 'canvas'});\n",
       "        var option_f1528710866a4d2d8a44122e86d96ca1 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"data1\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                29,\n",
       "                51,\n",
       "                26,\n",
       "                37,\n",
       "                116,\n",
       "                56,\n",
       "                90\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"data1\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u8349\\u8393\",\n",
       "                \"\\u8292\\u679c\",\n",
       "                \"\\u8461\\u8404\",\n",
       "                \"\\u96ea\\u68a8\",\n",
       "                \"\\u897f\\u74dc\",\n",
       "                \"\\u67e0\\u6aac\",\n",
       "                \"\\u8f66\\u5398\\u5b50\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"Bar-\\u5806\\u53e0\\u6570\\u636e\\uff08\\u5168\\u90e8\\uff09\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_f1528710866a4d2d8a44122e86d96ca1.setOption(option_f1528710866a4d2d8a44122e86d96ca1);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7f309af36b00>"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar2.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "data1 = [list(z) for z in zip(Faker.choose(), Faker.values())]\n",
    "\n",
    "data2 = [list(z) for z in zip(Faker.choose(), Faker.values())]\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": "new Promise(function(resolve, reject) {\n    var script = document.createElement(\"script\");\n    script.onload = resolve;\n    script.onerror = reject;\n    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n    document.head.appendChild(script);\n}).then(() => {\n\n});",
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x7f309a28a290>"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pie2 = (\n",
    "    Pie()\n",
    "    .add(\"\",data1,center=[\"30%\",\"50%\"],radius=[30,80])\n",
    "    .add(\"\",data2,center=[\"70%\",\"50%\"],radius=80)\n",
    "    .add(\"\",data2,center=[\"50%\",\"70%\"],radius=60)\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"Pie-多饼图基本示例\"),\n",
    "\n",
    "    )\n",
    ")\n",
    "pie2.load_javascript()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"f96fd01248f347dfb7f6b08c249f60fe\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_f96fd01248f347dfb7f6b08c249f60fe = echarts.init(\n",
       "            document.getElementById('f96fd01248f347dfb7f6b08c249f60fe'), 'white', {renderer: 'canvas'});\n",
       "        var option_f96fd01248f347dfb7f6b08c249f60fe = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"colorBy\": \"data\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"selectedMode\": false,\n",
       "            \"selectedOffset\": 10,\n",
       "            \"clockwise\": true,\n",
       "            \"startAngle\": 90,\n",
       "            \"minAngle\": 0,\n",
       "            \"minShowLabelAngle\": 0,\n",
       "            \"avoidLabelOverlap\": true,\n",
       "            \"stillShowZeroSum\": true,\n",
       "            \"percentPrecision\": 2,\n",
       "            \"showEmptyCircle\": true,\n",
       "            \"emptyCircleStyle\": {\n",
       "                \"color\": \"lightgray\",\n",
       "                \"borderColor\": \"#000\",\n",
       "                \"borderWidth\": 0,\n",
       "                \"borderType\": \"solid\",\n",
       "                \"borderDashOffset\": 0,\n",
       "                \"borderCap\": \"butt\",\n",
       "                \"borderJoin\": \"bevel\",\n",
       "                \"borderMiterLimit\": 10,\n",
       "                \"opacity\": 1\n",
       "            },\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5c0f\\u7c73\",\n",
       "                    \"value\": 81\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e09\\u661f\",\n",
       "                    \"value\": 39\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u534e\\u4e3a\",\n",
       "                    \"value\": 78\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u82f9\\u679c\",\n",
       "                    \"value\": 71\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9b45\\u65cf\",\n",
       "                    \"value\": 86\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"VIVO\",\n",
       "                    \"value\": 100\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"OPPO\",\n",
       "                    \"value\": 92\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": [\n",
       "                30,\n",
       "                80\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"30%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"labelLine\": {\n",
       "                \"show\": true,\n",
       "                \"showAbove\": false,\n",
       "                \"length\": 15,\n",
       "                \"length2\": 15,\n",
       "                \"smooth\": false,\n",
       "                \"minTurnAngle\": 90,\n",
       "                \"maxSurfaceAngle\": 90\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"colorBy\": \"data\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"selectedMode\": false,\n",
       "            \"selectedOffset\": 10,\n",
       "            \"clockwise\": true,\n",
       "            \"startAngle\": 90,\n",
       "            \"minAngle\": 0,\n",
       "            \"minShowLabelAngle\": 0,\n",
       "            \"avoidLabelOverlap\": true,\n",
       "            \"stillShowZeroSum\": true,\n",
       "            \"percentPrecision\": 2,\n",
       "            \"showEmptyCircle\": true,\n",
       "            \"emptyCircleStyle\": {\n",
       "                \"color\": \"lightgray\",\n",
       "                \"borderColor\": \"#000\",\n",
       "                \"borderWidth\": 0,\n",
       "                \"borderType\": \"solid\",\n",
       "                \"borderDashOffset\": 0,\n",
       "                \"borderCap\": \"butt\",\n",
       "                \"borderJoin\": \"bevel\",\n",
       "                \"borderMiterLimit\": 10,\n",
       "                \"opacity\": 1\n",
       "            },\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5c0f\\u7c73\",\n",
       "                    \"value\": 33\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e09\\u661f\",\n",
       "                    \"value\": 133\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u534e\\u4e3a\",\n",
       "                    \"value\": 116\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u82f9\\u679c\",\n",
       "                    \"value\": 118\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9b45\\u65cf\",\n",
       "                    \"value\": 92\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"VIVO\",\n",
       "                    \"value\": 88\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"OPPO\",\n",
       "                    \"value\": 75\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": 80,\n",
       "            \"center\": [\n",
       "                \"70%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"labelLine\": {\n",
       "                \"show\": true,\n",
       "                \"showAbove\": false,\n",
       "                \"length\": 15,\n",
       "                \"length2\": 15,\n",
       "                \"smooth\": false,\n",
       "                \"minTurnAngle\": 90,\n",
       "                \"maxSurfaceAngle\": 90\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"pie\",\n",
       "            \"colorBy\": \"data\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"selectedMode\": false,\n",
       "            \"selectedOffset\": 10,\n",
       "            \"clockwise\": true,\n",
       "            \"startAngle\": 90,\n",
       "            \"minAngle\": 0,\n",
       "            \"minShowLabelAngle\": 0,\n",
       "            \"avoidLabelOverlap\": true,\n",
       "            \"stillShowZeroSum\": true,\n",
       "            \"percentPrecision\": 2,\n",
       "            \"showEmptyCircle\": true,\n",
       "            \"emptyCircleStyle\": {\n",
       "                \"color\": \"lightgray\",\n",
       "                \"borderColor\": \"#000\",\n",
       "                \"borderWidth\": 0,\n",
       "                \"borderType\": \"solid\",\n",
       "                \"borderDashOffset\": 0,\n",
       "                \"borderCap\": \"butt\",\n",
       "                \"borderJoin\": \"bevel\",\n",
       "                \"borderMiterLimit\": 10,\n",
       "                \"opacity\": 1\n",
       "            },\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5c0f\\u7c73\",\n",
       "                    \"value\": 33\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e09\\u661f\",\n",
       "                    \"value\": 133\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u534e\\u4e3a\",\n",
       "                    \"value\": 116\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u82f9\\u679c\",\n",
       "                    \"value\": 118\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9b45\\u65cf\",\n",
       "                    \"value\": 92\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"VIVO\",\n",
       "                    \"value\": 88\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"OPPO\",\n",
       "                    \"value\": 75\n",
       "                }\n",
       "            ],\n",
       "            \"radius\": 60,\n",
       "            \"center\": [\n",
       "                \"50%\",\n",
       "                \"70%\"\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"labelLine\": {\n",
       "                \"show\": true,\n",
       "                \"showAbove\": false,\n",
       "                \"length\": 15,\n",
       "                \"length2\": 15,\n",
       "                \"smooth\": false,\n",
       "                \"minTurnAngle\": 90,\n",
       "                \"maxSurfaceAngle\": 90\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"VIVO\",\n",
       "                \"OPPO\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"Pie-\\u591a\\u997c\\u56fe\\u57fa\\u672c\\u793a\\u4f8b\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_f96fd01248f347dfb7f6b08c249f60fe.setOption(option_f96fd01248f347dfb7f6b08c249f60fe);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7f309a28bb50>"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pie2.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": "new Promise(function(resolve, reject) {\n    var script = document.createElement(\"script\");\n    script.onload = resolve;\n    script.onerror = reject;\n    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n    document.head.appendChild(script);\n}).then(() => {\n\n});",
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x7f309a295240>"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar3 = (\n",
    "    Bar()\n",
    "    .add_xaxis([item[0] for item in data1])\n",
    "    .add_yaxis(\"2021\", [item[1] for item in data1])\n",
    "    .add_yaxis(\"2022\", [item[1] for item in data2])\n",
    "    .set_series_opts(label_opts=opts.LabelOpts(is_show=False))\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"Bar\"))\n",
    ")\n",
    "bar3.load_javascript()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"a080df787f5f46ada41ee5220a434a1d\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_a080df787f5f46ada41ee5220a434a1d = echarts.init(\n",
       "            document.getElementById('a080df787f5f46ada41ee5220a434a1d'), 'white', {renderer: 'canvas'});\n",
       "        var option_a080df787f5f46ada41ee5220a434a1d = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"2021\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                81,\n",
       "                39,\n",
       "                78,\n",
       "                71,\n",
       "                86,\n",
       "                100,\n",
       "                92\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"2022\",\n",
       "            \"legendHoverLink\": true,\n",
       "            \"data\": [\n",
       "                33,\n",
       "                133,\n",
       "                116,\n",
       "                118,\n",
       "                92,\n",
       "                88,\n",
       "                75\n",
       "            ],\n",
       "            \"realtimeSort\": false,\n",
       "            \"showBackground\": false,\n",
       "            \"stackStrategy\": \"samesign\",\n",
       "            \"cursor\": \"pointer\",\n",
       "            \"barMinHeight\": 0,\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"barGap\": \"30%\",\n",
       "            \"large\": false,\n",
       "            \"largeThreshold\": 400,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"datasetIndex\": 0,\n",
       "            \"clip\": true,\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 2,\n",
       "            \"label\": {\n",
       "                \"show\": false,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"rippleEffect\": {\n",
       "                \"show\": true,\n",
       "                \"brushType\": \"stroke\",\n",
       "                \"scale\": 2.5,\n",
       "                \"period\": 4\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"2021\",\n",
       "                \"2022\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5c0f\\u7c73\",\n",
       "                \"\\u4e09\\u661f\",\n",
       "                \"\\u534e\\u4e3a\",\n",
       "                \"\\u82f9\\u679c\",\n",
       "                \"\\u9b45\\u65cf\",\n",
       "                \"VIVO\",\n",
       "                \"OPPO\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"Bar\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_a080df787f5f46ada41ee5220a434a1d.setOption(option_a080df787f5f46ada41ee5220a434a1d);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7f309a297cd0>"
      ]
     },
     "execution_count": 93,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar3.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": "new Promise(function(resolve, reject) {\n    var script = document.createElement(\"script\");\n    script.onload = resolve;\n    script.onerror = reject;\n    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n    document.head.appendChild(script);\n}).then(() => {\n\n});",
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x7f309a2959c0>"
      ]
     },
     "execution_count": 94,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Line\n",
    "\n",
    "line1 = (\n",
    "    Line()\n",
    "    .add_xaxis(Faker.choose())\n",
    "    .add_yaxis('data1',Faker.values(),stack='total',areastyle_opts=opts.AreaStyleOpts(opacity=0.5))\n",
    "    .add_yaxis('data2',Faker.values(),stack='total',areastyle_opts=opts.AreaStyleOpts(opacity=0.5))\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"Line-面积图\"))\n",
    ")\n",
    "line1.load_javascript()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"bb6d140b10bf4bf7bf2c2275afd392ea\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_bb6d140b10bf4bf7bf2c2275afd392ea = echarts.init(\n",
       "            document.getElementById('bb6d140b10bf4bf7bf2c2275afd392ea'), 'white', {renderer: 'canvas'});\n",
       "        var option_bb6d140b10bf4bf7bf2c2275afd392ea = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"data1\",\n",
       "            \"connectNulls\": false,\n",
       "            \"xAxisIndex\": 0,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"stack\": \"total\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5468\\u4e00\",\n",
       "                    105\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e8c\",\n",
       "                    141\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e09\",\n",
       "                    20\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u56db\",\n",
       "                    27\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e94\",\n",
       "                    118\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u516d\",\n",
       "                    102\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u65e5\",\n",
       "                    33\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"logBase\": 10,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0.5\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        },\n",
       "        {\n",
       "            \"type\": \"line\",\n",
       "            \"name\": \"data2\",\n",
       "            \"connectNulls\": false,\n",
       "            \"xAxisIndex\": 0,\n",
       "            \"symbolSize\": 4,\n",
       "            \"showSymbol\": true,\n",
       "            \"smooth\": false,\n",
       "            \"clip\": true,\n",
       "            \"step\": false,\n",
       "            \"stack\": \"total\",\n",
       "            \"data\": [\n",
       "                [\n",
       "                    \"\\u5468\\u4e00\",\n",
       "                    82\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e8c\",\n",
       "                    33\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e09\",\n",
       "                    78\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u56db\",\n",
       "                    144\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u4e94\",\n",
       "                    86\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u516d\",\n",
       "                    88\n",
       "                ],\n",
       "                [\n",
       "                    \"\\u5468\\u65e5\",\n",
       "                    78\n",
       "                ]\n",
       "            ],\n",
       "            \"hoverAnimation\": true,\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"logBase\": 10,\n",
       "            \"seriesLayoutBy\": \"column\",\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0,\n",
       "                \"type\": \"solid\"\n",
       "            },\n",
       "            \"areaStyle\": {\n",
       "                \"opacity\": 0.5\n",
       "            },\n",
       "            \"zlevel\": 0,\n",
       "            \"z\": 0\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"data1\",\n",
       "                \"data2\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u5468\\u4e00\",\n",
       "                \"\\u5468\\u4e8c\",\n",
       "                \"\\u5468\\u4e09\",\n",
       "                \"\\u5468\\u56db\",\n",
       "                \"\\u5468\\u4e94\",\n",
       "                \"\\u5468\\u516d\",\n",
       "                \"\\u5468\\u65e5\"\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"scale\": false,\n",
       "            \"nameLocation\": \"end\",\n",
       "            \"nameGap\": 15,\n",
       "            \"gridIndex\": 0,\n",
       "            \"inverse\": false,\n",
       "            \"offset\": 0,\n",
       "            \"splitNumber\": 5,\n",
       "            \"minInterval\": 0,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true,\n",
       "                \"lineStyle\": {\n",
       "                    \"show\": true,\n",
       "                    \"width\": 1,\n",
       "                    \"opacity\": 1,\n",
       "                    \"curveness\": 0,\n",
       "                    \"type\": \"solid\"\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"Line-\\u9762\\u79ef\\u56fe\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_bb6d140b10bf4bf7bf2c2275afd392ea.setOption(option_bb6d140b10bf4bf7bf2c2275afd392ea);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7f309a295000>"
      ]
     },
     "execution_count": 95,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "line1.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": "new Promise(function(resolve, reject) {\n    var script = document.createElement(\"script\");\n    script.onload = resolve;\n    script.onerror = reject;\n    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n    document.head.appendChild(script);\n}).then(() => {\n\n});",
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x7f309a294880>"
      ]
     },
     "execution_count": 96,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import TreeMap\n",
    "\n",
    "data = [\n",
    "    {\"value\": 40, \"name\": \"我是A\"},\n",
    "    {\n",
    "        \"value\": 180,\n",
    "        \"name\": \"我是B\",\n",
    "        \"children\": [\n",
    "            {\n",
    "                \"value\": 76,\n",
    "                \"name\": \"我是B.children\",\n",
    "                \"children\": [\n",
    "                    {\"value\": 12, \"name\": \"我是B.children.a\"},\n",
    "                    {\"value\": 28, \"name\": \"我是B.children.b\"},\n",
    "                    {\"value\": 20, \"name\": \"我是B.children.c\"},\n",
    "                    {\"value\": 16, \"name\": \"我是B.children.d\"},\n",
    "                ],\n",
    "            }\n",
    "        ],\n",
    "    },\n",
    "]\n",
    "\n",
    "treemap = (\n",
    "    TreeMap()\n",
    "    .add(\"演示数据\", data)\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"TreeMap-基本示例\"))\n",
    ")\n",
    "treemap.load_javascript()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"963b62daba4248f79d1d573cbd46853d\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_963b62daba4248f79d1d573cbd46853d = echarts.init(\n",
       "            document.getElementById('963b62daba4248f79d1d573cbd46853d'), 'white', {renderer: 'canvas'});\n",
       "        var option_963b62daba4248f79d1d573cbd46853d = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"treemap\",\n",
       "            \"name\": \"\\u6f14\\u793a\\u6570\\u636e\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"value\": 40,\n",
       "                    \"name\": \"\\u6211\\u662fA\"\n",
       "                },\n",
       "                {\n",
       "                    \"value\": 180,\n",
       "                    \"name\": \"\\u6211\\u662fB\",\n",
       "                    \"children\": [\n",
       "                        {\n",
       "                            \"value\": 76,\n",
       "                            \"name\": \"\\u6211\\u662fB.children\",\n",
       "                            \"children\": [\n",
       "                                {\n",
       "                                    \"value\": 12,\n",
       "                                    \"name\": \"\\u6211\\u662fB.children.a\"\n",
       "                                },\n",
       "                                {\n",
       "                                    \"value\": 28,\n",
       "                                    \"name\": \"\\u6211\\u662fB.children.b\"\n",
       "                                },\n",
       "                                {\n",
       "                                    \"value\": 20,\n",
       "                                    \"name\": \"\\u6211\\u662fB.children.c\"\n",
       "                                },\n",
       "                                {\n",
       "                                    \"value\": 16,\n",
       "                                    \"name\": \"\\u6211\\u662fB.children.d\"\n",
       "                                }\n",
       "                            ]\n",
       "                        }\n",
       "                    ]\n",
       "                }\n",
       "            ],\n",
       "            \"width\": \"80%\",\n",
       "            \"height\": \"80%\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"inside\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"upperLabel\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"inside\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"drillDownIcon\": \"\\u25b6\",\n",
       "            \"roam\": true,\n",
       "            \"nodeClick\": \"zoomToNode\",\n",
       "            \"zoomToNodeRatio\": 0.1024,\n",
       "            \"colorMappingBy\": \"index\",\n",
       "            \"visibleMin\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u6f14\\u793a\\u6570\\u636e\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"TreeMap-\\u57fa\\u672c\\u793a\\u4f8b\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_963b62daba4248f79d1d573cbd46853d.setOption(option_963b62daba4248f79d1d573cbd46853d);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7f309a294b80>"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "treemap.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": "new Promise(function(resolve, reject) {\n    var script = document.createElement(\"script\");\n    script.onload = resolve;\n    script.onerror = reject;\n    script.src = \"https://assets.pyecharts.org/assets/v5/echarts.min.js\";\n    document.head.appendChild(script);\n}).then(() => {\n\n});",
      "text/plain": [
       "<pyecharts.render.display.Javascript at 0x7f309a28a080>"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import json\n",
    "\n",
    "from pyecharts.charts import Sankey\n",
    "\n",
    "with open(\"data.json\", \"r\", encoding=\"utf-8\") as f:\n",
    "    j = json.load(f)\n",
    "sankey = (\n",
    "    Sankey()\n",
    "    .add(\n",
    "        \"sankey\",\n",
    "        nodes=j[\"nodes\"],\n",
    "        links=j[\"links\"],\n",
    "        pos_top=\"10%\",\n",
    "        levels=[\n",
    "            opts.SankeyLevelsOpts(\n",
    "                depth=0,\n",
    "                itemstyle_opts=opts.ItemStyleOpts(color=\"#fbb4ae\"),\n",
    "                linestyle_opts=opts.LineStyleOpts(color=\"source\", opacity=0.6),\n",
    "            ),\n",
    "            opts.SankeyLevelsOpts(\n",
    "                depth=1,\n",
    "                itemstyle_opts=opts.ItemStyleOpts(color=\"#b3cde3\"),\n",
    "                linestyle_opts=opts.LineStyleOpts(color=\"source\", opacity=0.6),\n",
    "            ),\n",
    "            opts.SankeyLevelsOpts(\n",
    "                depth=2,\n",
    "                itemstyle_opts=opts.ItemStyleOpts(color=\"#ccebc5\"),\n",
    "                linestyle_opts=opts.LineStyleOpts(color=\"source\", opacity=0.6),\n",
    "            ),\n",
    "            opts.SankeyLevelsOpts(\n",
    "                depth=3,\n",
    "                itemstyle_opts=opts.ItemStyleOpts(color=\"#decbe4\"),\n",
    "                linestyle_opts=opts.LineStyleOpts(color=\"source\", opacity=0.6),\n",
    "            ),\n",
    "        ],\n",
    "        linestyle_opt=opts.LineStyleOpts(curve=0.5),\n",
    "    )\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"Sankey-Level Settings\"),\n",
    "        tooltip_opts=opts.TooltipOpts(trigger=\"item\", trigger_on=\"mousemove\"),\n",
    "    )\n",
    ")\n",
    "sankey.load_javascript()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!DOCTYPE html>\n",
       "<html>\n",
       "<head>\n",
       "    <meta charset=\"UTF-8\">\n",
       "</head>\n",
       "<body>\n",
       "        <div id=\"bb6d7fe6b41d4521b6684355df91761a\" class=\"chart-container\" style=\"width:900px; height:500px; \"></div>\n",
       "    <script>\n",
       "        var chart_bb6d7fe6b41d4521b6684355df91761a = echarts.init(\n",
       "            document.getElementById('bb6d7fe6b41d4521b6684355df91761a'), 'white', {renderer: 'canvas'});\n",
       "        var option_bb6d7fe6b41d4521b6684355df91761a = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"aria\": {\n",
       "        \"enabled\": false\n",
       "    },\n",
       "    \"color\": [\n",
       "        \"#5470c6\",\n",
       "        \"#91cc75\",\n",
       "        \"#fac858\",\n",
       "        \"#ee6666\",\n",
       "        \"#73c0de\",\n",
       "        \"#3ba272\",\n",
       "        \"#fc8452\",\n",
       "        \"#9a60b4\",\n",
       "        \"#ea7ccc\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"sankey\",\n",
       "            \"name\": \"sankey\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"Total\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Environment\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Land use\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Cocoa butter (Organic)\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Cocoa mass (Organic)\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Hazelnuts (Organic)\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Cane sugar (Organic)\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Vegetables (Organic)\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Climate change\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Harmful substances\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Water use\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Resource depletion\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Refrigeration\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Packaging\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Human rights\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Child labour\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Coconut oil (Organic)\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Forced labour\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Health safety\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Access to water\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Freedom of association\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Access to land\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Sufficient wage\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Equal rights migrants\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Discrimination\"\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"Working hours\"\n",
       "                }\n",
       "            ],\n",
       "            \"links\": [\n",
       "                {\n",
       "                    \"source\": \"Total\",\n",
       "                    \"target\": \"Environment\",\n",
       "                    \"value\": 0.342284047256003\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Environment\",\n",
       "                    \"target\": \"Land use\",\n",
       "                    \"value\": 0.32322870366987\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Land use\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.177682517071359\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Land use\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.137241325342711\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Land use\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.00433076373512774\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Land use\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.00296956039863467\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Land use\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00100453712203756\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Environment\",\n",
       "                    \"target\": \"Climate change\",\n",
       "                    \"value\": 0.0112886157414413\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Climate change\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.00676852971933996\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Climate change\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.00394686874786743\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Climate change\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.000315972058711838\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Climate change\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.000218969462265292\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Climate change\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 3.82757532567656e-05\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Environment\",\n",
       "                    \"target\": \"Harmful substances\",\n",
       "                    \"value\": 0.00604275542495656\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Harmful substances\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.0055125989240741\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Harmful substances\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.000330017607892127\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Harmful substances\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.000200138892990337\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Harmful substances\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Harmful substances\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Environment\",\n",
       "                    \"target\": \"Water use\",\n",
       "                    \"value\": 0.00148345269044703\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Water use\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.00135309891304186\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Water use\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.000105714137908639\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Water use\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 1.33452642581887e-05\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Water use\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 8.78074837009238e-06\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Water use\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 2.5136268682477e-06\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Environment\",\n",
       "                    \"target\": \"Resource depletion\",\n",
       "                    \"value\": 0.000240519729288764\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Resource depletion\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.000226237279345084\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Resource depletion\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 1.42824499436793e-05\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Resource depletion\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Resource depletion\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Resource depletion\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Environment\",\n",
       "                    \"target\": \"Refrigeration\",\n",
       "                    \"value\": 0\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Environment\",\n",
       "                    \"target\": \"Packaging\",\n",
       "                    \"value\": 0\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Total\",\n",
       "                    \"target\": \"Human rights\",\n",
       "                    \"value\": 0.307574096993239\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Child labour\",\n",
       "                    \"value\": 0.0410641202645833\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Child labour\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.0105339381639722\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Child labour\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.0105\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Child labour\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0087294420777\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Child labour\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0.00474399974233333\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Child labour\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.00388226450884445\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Child labour\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00267447577173333\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Forced labour\",\n",
       "                    \"value\": 0.0365458590642445\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Forced labour\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.0114913076376389\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Forced labour\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0081134807347\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Forced labour\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.00765230236575\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Forced labour\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.004\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Forced labour\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00296668823626667\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Forced labour\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0.00232208008988889\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Health safety\",\n",
       "                    \"value\": 0.0345435327843611\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Health safety\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.0121419536385\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Health safety\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.00766772850678333\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Health safety\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0056245892061\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Health safety\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0.00361616847688889\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Health safety\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.00277374682533333\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Health safety\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00271934613075556\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Access to water\",\n",
       "                    \"value\": 0.0340206659360667\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to water\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.0105\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to water\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0089274160792\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to water\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.0054148022845\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to water\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.00333938149786667\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to water\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00314663377488889\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to water\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0.00269243229961111\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Freedom of association\",\n",
       "                    \"value\": 0.0320571523941667\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Freedom of association\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.0132312483463611\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Freedom of association\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0077695200707\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Freedom of association\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.00510606573995\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Freedom of association\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00354321156324444\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Freedom of association\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.00240710667391111\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Freedom of association\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Access to land\",\n",
       "                    \"value\": 0.0315022209894056\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to land\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.00964970063322223\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to land\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.00938530207965\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to land\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0060110791848\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to land\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.00380818314608889\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to land\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00264795594564445\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Access to land\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Sufficient wage\",\n",
       "                    \"value\": 0.0287776757227333\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Sufficient wage\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.00883512456493333\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Sufficient wage\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0078343367268\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Sufficient wage\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0.00347879026511111\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Sufficient wage\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.00316254211388889\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Sufficient wage\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00281013722808889\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Sufficient wage\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.00265674482391111\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Equal rights migrants\",\n",
       "                    \"value\": 0.0271146645119444\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Equal rights migrants\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0071042315061\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Equal rights migrants\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.00636673210005\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Equal rights migrants\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.00601459775836111\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Equal rights migrants\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0.00429185583138889\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Equal rights migrants\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.00182647471915556\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Equal rights migrants\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00151077259688889\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Discrimination\",\n",
       "                    \"value\": 0.0211217763359833\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Discrimination\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.00609671700306667\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Discrimination\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0047738806325\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Discrimination\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0.00368119084494444\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Discrimination\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00286009813604444\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Discrimination\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.00283706180951111\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Discrimination\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.000872827909916666\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Human rights\",\n",
       "                    \"target\": \"Working hours\",\n",
       "                    \"value\": 0.02082642898975\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Working hours\",\n",
       "                    \"target\": \"Hazelnuts (Organic)\",\n",
       "                    \"value\": 0.0107216773848333\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Working hours\",\n",
       "                    \"target\": \"Coconut oil (Organic)\",\n",
       "                    \"value\": 0.00359009052944444\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Working hours\",\n",
       "                    \"target\": \"Vegetables (Organic)\",\n",
       "                    \"value\": 0.00212300379075556\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Working hours\",\n",
       "                    \"target\": \"Cocoa butter (Organic)\",\n",
       "                    \"value\": 0.0018518584356\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Working hours\",\n",
       "                    \"target\": \"Cocoa mass (Organic)\",\n",
       "                    \"value\": 0.00158227069058333\n",
       "                },\n",
       "                {\n",
       "                    \"source\": \"Working hours\",\n",
       "                    \"target\": \"Cane sugar (Organic)\",\n",
       "                    \"value\": 0.000957528158533333\n",
       "                }\n",
       "            ],\n",
       "            \"left\": \"5%\",\n",
       "            \"top\": \"10%\",\n",
       "            \"right\": \"20%\",\n",
       "            \"bottom\": \"5%\",\n",
       "            \"nodeWidth\": 20,\n",
       "            \"nodeGap\": 8,\n",
       "            \"nodeAlign\": \"justify\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"draggable\": true,\n",
       "            \"levels\": [\n",
       "                {\n",
       "                    \"depth\": 0,\n",
       "                    \"itemStyle\": {\n",
       "                        \"color\": \"#fbb4ae\"\n",
       "                    },\n",
       "                    \"lineStyle\": {\n",
       "                        \"show\": true,\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 0.6,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\",\n",
       "                        \"color\": \"source\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"depth\": 1,\n",
       "                    \"itemStyle\": {\n",
       "                        \"color\": \"#b3cde3\"\n",
       "                    },\n",
       "                    \"lineStyle\": {\n",
       "                        \"show\": true,\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 0.6,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\",\n",
       "                        \"color\": \"source\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"depth\": 2,\n",
       "                    \"itemStyle\": {\n",
       "                        \"color\": \"#ccebc5\"\n",
       "                    },\n",
       "                    \"lineStyle\": {\n",
       "                        \"show\": true,\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 0.6,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\",\n",
       "                        \"color\": \"source\"\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"depth\": 3,\n",
       "                    \"itemStyle\": {\n",
       "                        \"color\": \"#decbe4\"\n",
       "                    },\n",
       "                    \"lineStyle\": {\n",
       "                        \"show\": true,\n",
       "                        \"width\": 1,\n",
       "                        \"opacity\": 0.6,\n",
       "                        \"curveness\": 0,\n",
       "                        \"type\": \"solid\",\n",
       "                        \"color\": \"source\"\n",
       "                    }\n",
       "                }\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"lineStyle\": {\n",
       "                \"show\": true,\n",
       "                \"width\": 1,\n",
       "                \"opacity\": 1,\n",
       "                \"curveness\": 0.5,\n",
       "                \"type\": \"solid\"\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"sankey\"\n",
       "            ],\n",
       "            \"selected\": {},\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14,\n",
       "            \"backgroundColor\": \"transparent\",\n",
       "            \"borderColor\": \"#ccc\",\n",
       "            \"borderRadius\": 0,\n",
       "            \"pageButtonItemGap\": 5,\n",
       "            \"pageButtonPosition\": \"end\",\n",
       "            \"pageFormatter\": \"{current}/{total}\",\n",
       "            \"pageIconColor\": \"#2f4554\",\n",
       "            \"pageIconInactiveColor\": \"#aaa\",\n",
       "            \"pageIconSize\": 15,\n",
       "            \"animationDurationUpdate\": 800,\n",
       "            \"selector\": false,\n",
       "            \"selectorPosition\": \"auto\",\n",
       "            \"selectorItemGap\": 7,\n",
       "            \"selectorButtonGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"showContent\": true,\n",
       "        \"alwaysShowContent\": false,\n",
       "        \"showDelay\": 0,\n",
       "        \"hideDelay\": 100,\n",
       "        \"enterable\": false,\n",
       "        \"confine\": false,\n",
       "        \"appendToBody\": false,\n",
       "        \"transitionDuration\": 0.4,\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"padding\": 5,\n",
       "        \"order\": \"seriesAsc\"\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"show\": true,\n",
       "            \"text\": \"Sankey-Level Settings\",\n",
       "            \"target\": \"blank\",\n",
       "            \"subtarget\": \"blank\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"textAlign\": \"auto\",\n",
       "            \"textVerticalAlign\": \"auto\",\n",
       "            \"triggerEvent\": false\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "        chart_bb6d7fe6b41d4521b6684355df91761a.setOption(option_bb6d7fe6b41d4521b6684355df91761a);\n",
       "    </script>\n",
       "</body>\n",
       "</html>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x7f309a288b20>"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sankey.render_notebook()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "class",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
